package tech.aistar.day12.homework;

import tech.aistar.day12.Purcase;

import java.util.List;

/**
 * 本类用来演示: 单元测试
 *
 * @author: success
 * @date: 2022/8/4 8:45 上午
 */
public class BaseDaoTest {
    public static void main(String[] args) {
        PurcaseDao dao = new PurcaseDaoImpl();


        //模拟数据 - 写入
        Purcase p1 = new Purcase("宝洁","ddd",100.0d);
        Purcase p2 = new Purcase("联合利华","cc",300.0d);
        Purcase p3 = new Purcase("悦刻","ddd",200.0d);
        Purcase p4 = new Purcase("柚子","cc",150.0d);
        Purcase p5 = new Purcase("YOYO","ddd",100.0d);
        //dao.save(p1);
        //dao.save(p2);
        //dao.save(p3);
        //dao.save(p4);
        //dao.save(p5);

        //调用删除的方法
        dao.deByPrice(200);

        List<Purcase> list = dao.getAll();

        if(null!=list && list.size()>0){
            for (Purcase purcase : list) {
                System.out.println(purcase);
            }
        }else{
            System.out.println("sorry,请先添加数据!");
        }
    }
}
